package 刷题7月.链表反转递归;

public class Concurrency implements Runnable {
    int tickNumber=100;
    public void run(){
        while(true){
            if(tickNumber<=0){
                break;
            }
            try{
                Thread.sleep(1000);
            }
            catch(Exception e){
                e.printStackTrace();
            }
            //抢票 获得Thread的引用及其名字
            System.out.println(Thread.currentThread().getName()+"拿到了第"+tickNumber--+"票");
        }

    }

    public static void main(String []args){
        Concurrency c=new Concurrency();
        //多个线程操作同一对象，将会出现并发问题
		new Thread (c,"小明").start();
		new Thread (c,"老师").start();
        new Thread (c,"黄牛").start();


    }
}
